import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsNotEmpty, IsNumber, Matches } from 'class-validator';

export class CreatePublicityDto {
  @ApiProperty({ example: '1234567', description: '标题' })
  @IsString()
  @IsNotEmpty({ groups: ['create'], message: '标题必须填写' })
  title: string;

  @ApiProperty({ example: '1234567', description: '内容' })
  @IsString()
  @IsNotEmpty({ groups: ['create'], message: '内容必须填写' })
  content: string;

  // @ApiProperty({
  //   example: '2022-02-02',
  //   description: '年月日必须填写',
  //   required: true,
  // })
  // @Matches(/^\d{4}-\d{2}-\d{2}$/, {
  //   message: 'Invalid format. Expected format:  YYYY-MM-DD',
  // })
  // @IsNotEmpty({ groups: ['create'], message: '年月日必须填写' })
  created_time: string;

  created_name: string;
  created_name_id: string;
}
